$(document).ready(function(){
	$("#addline").click(function() {
		var $datatable = $("#datatable tr");
		var len=$datatable.length-3;
		var lenid=len-1;
		var newline = "<tr align='center' bgcolor='#FFFFFF' height='22'>"
			+"<td><input type='checkbox' id='selectedList' name='selectedList' value='"+lenid+"' class='np'></td>"
			+"<td><input type='text' class='tdinput1' border='0' "+"name='categories["+lenid+"].category_name' /></td>"
			+"<td><input type='text' class='tdinput2' "+"name='categories["+lenid+"].discription' /></td></tr>"
		//alert("newline:"+newline);
		var currentRow=$('#datatable:first tbody tr:eq('+len+')');
	    currentRow.after(newline);
	});
	$("#removeline").click(function() {
		var $datatable = $("#datatable tr");
		var len=$datatable.length-3;
		var currentRow=$('#datatable:first tbody tr:eq('+len+')');
		if(len>=3){
			currentRow.remove();
		}
	});
});

